package com.rain.shoppingscienceproj.http;


import com.rain.shoppingscienceproj.module.Address;
import com.rain.shoppingscienceproj.module.CarData;
import com.rain.shoppingscienceproj.module.Comment;
import com.rain.shoppingscienceproj.module.Goods;
import com.rain.shoppingscienceproj.module.GoodsDto;
import com.rain.shoppingscienceproj.module.LogisticsData;
import com.rain.shoppingscienceproj.module.Massage;
import com.rain.shoppingscienceproj.module.OrderBetweenDto;
import com.rain.shoppingscienceproj.module.StoreInfo;
import com.rain.shoppingscienceproj.module.UserInfo;
import com.rain.shoppingscienceproj.module.WeChatPayBean;

import java.util.List;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import rx.Observable;

/**
 * Created by Rain on 2017/6/13 0013.
 */

public interface BaseApiService {

//    String Base_URL = "http://192.168.31.226:8081";

    String Base_URL = "http://47.105.119.223:8080";
//    String Base_URL = "http://192.168.31.130:8080";

    String imageUrl = "https://storeshopping.oss-cn-beijing.aliyuncs.com/";


    //登录/
    String login = "/sysUser/userLogin";

    String userInfos = "/sysUser/getUserInfo";
    //注册
    String register = "/regist/registerUser";
    //忘记密码
    String forgetpwd = "/regist/updataUserPass";

    //新改接口 获取商品
    String typeGoods = "/goods/getGoods";

    //新改接口 获取商品详情
    String goodsDetaile = "/goods/getGoodsByPrimaryKey";

    //新 评论列表
    String commentList = "/goods/getGoodsContext";

    //新 加入购物车
    String addCar = "/order/saveShoppingCar";

    //新 修改购物车数量
    String upCar = "/order/updateShoppingCarGoods";

    //新 购物车列表
    String queryCarList = "/order/queryShoppingCar";
    //新 删除购物车
    String delCar = "/order/removeShoppingCarGoods";
    //新 添加地址
    String addAdress = "/sysUser/addUserAddress";
    //新 删除地址
    String delAdress = "/sysUser/removeUserAddress";
    //新 修改地址
    String upaAdress = "/sysUser/updateUserAddress";
    //新 查看地址
    String queryAddress = "/sysUser/getUserAddress";
    //新 查看默认地址
    String queryApproveAddress = "/sysUser/getddefaultUserAddress";

    //新 直接购买
    String submitOneOrder = "/order/saveOrderByGoods";

    //新 购物车结算
    String submitOrder = "/order/saveOrderByShoppingCar";

    //新 支付
    String pay = "/order/payOrder";

    //新 根据状态获取订单
    String orderStatus = "/order/getMyOrder";

    //新 订单详情
    String orderdetails = "/order/getOrderInfo";

    //新 取消订单
    String cancelOrder = "/order/cancellationOrder";

    String sureOrder = "/order/updateOrder";//发货 改成3 确认收货4

    //新 修改个人资料
    String updateuser = "/sysUser/updataUserInfo";

    //新 反馈
    String feedBack = "/sysUser/addRemake";

    //新 评论
    String comment = "/goods/addGoodsContext";

    //新 物流
    String queryordermanage = "/order/getOrderExpress";

    //新 消息
    String messageList = "/sysUser/getAllmessage";

    String storeInfo = "/goods/getShopeGoods";
    //
    String storeDetaile = "/queryshopdetils/QueryShopDetils";

    String mainDetail = "/queryprovince/QueryProvince";
    //
    String changepwd = "/changepwd/ChangePwd";

    String upPhoto = "/updateuser/uplondeImage";

    //
    String goodsList = "/querygoodsList/QueryGoodsList";
    //
    String secondSearch = "/querylike/QueryLike";
    //
    String store = "/queryshop/QueryShop";
    //
    String storeList = "/queryshopList/QueryShopList";

    //
    String userInfo = "/queryuserinfo/QueryUserInfo";
    //
    String addGoods = "/savagoods/SavaGoods";
    //
    String addStore = "/savashop/SavaShop";
    //
    String updategoodslimit = "/updategoodslimit/UpdateGoodslimit";

    String delstore = "/savashop/deleteShopByBack";

    String bankInfo = "/savashop/updateUserBack";

    String wallet = "/querywallet/queryWallet";

    String savawithdraw = "/savawithdraw/SaveWithdraw";
    //查询代理人
    String agentUser = "/agent/QueryAgent";
    //添加代理
    String savaAgent = "/agent/savaAgent";
    //我的代理人
    String myAgent = "/agent/queryMyAgent";
    //我的代理商商品
    String agent_goods = "/agent/queryInfoGoods";
    //我的分销商
    String distribution = "/agent/queryDistribution";
    //我的分销商商品
    String distribution_goods = "/agent/queryDistributionGoods";
    //商户订单
    String storeOrder = "/queryorderbystatus/QueryShopOrderByStatus";

    String storeCommentList = "/context/shopContextList";

    String querywallet = "/querywallet/queryWalletDetail";

    String uploadFileBase = "/file/uploadFileBase";

    String registeruser = "/registeruser/verifyUserPhone";

    String queryorderbystatus = "/queryorderbystatus/QueryOrderPayStatus";

    String delGoods = "/savagoods/removeGoods";

    String saveGoods = "/savagoods/updateGoods";

    String savashop = "/savashop/updateShop";

    String querygoodsdetils = "/querygoodsdetils/QueryGoodsCarousel";

    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */
    @FormUrlEncoded
    @POST(login)
    Observable<ResponseBody> login(@Field("userPhone") String username, @Field("passWord") String password, @Field("deviceId") String deviceId, @Field("type") int type);

    @FormUrlEncoded
    @POST(userInfos)
    Observable<ResponseBody> userInfo(@Field("userId") String userId);

    @FormUrlEncoded
    @POST(delGoods)
    Observable<ResponseBody> delGoods(@FieldMap Map<String, String> map);

    /**
     * 获取验证码
     *
     * @param userPhone
     * @return
     */
    @FormUrlEncoded
    @POST("/regist/sms")
    Observable<ResponseBody> getCode(@Field("userPhone") String userPhone);


    @FormUrlEncoded
    @POST(registeruser)
    Observable<ResponseBody> registeruser(@Field("userPhone") String userPhone, @Field("code") String code);

    /**
     * String userPhone,
     * String passWord,
     * String code
     * 注册
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(register)
    Observable<ResponseBody> register(@FieldMap Map<String, String> map);

    /**
     * 修改密码
     * String userId
     * String token,
     * String userPhone,
     * String oldPassWord,
     * String newPassWord
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(changepwd)
    Observable<ResponseBody> changepwd(@FieldMap Map<String, String> map);


    /**
     * 忘记密码
     * String userPhone,
     * String passWord,
     * String code
     *
     * @return
     */
    @FormUrlEncoded
    @POST(forgetpwd)
    Observable<ResponseBody> forgetpwd(@FieldMap Map<String, String> map);


    @FormUrlEncoded
    @POST(mainDetail)
    Observable<ResponseBody> mainDetail(@Field("provinceCode") String provinceId);

    /**
     * 修改用户资料
     * String userId,
     * String token,
     * String userSex,
     * String userRealName,
     * String userIdCard,
     * String userBrithday,
     * String userAddress
     *
     * @return
     */
    @FormUrlEncoded
    @POST(updateuser)
    Observable<ResponseBody> updateuser(@FieldMap Map<String, String> map);


    @Multipart
    @POST(upPhoto)
    Observable<ResponseBody> upPhoto(@PartMap() Map<String, RequestBody> map, @Part() MultipartBody.Part[] files);


    /**
     * 用户信息
     * String userId,
     * String token
     *
     * @return
     */
    @FormUrlEncoded
    @POST(userInfo)
    Observable<BaseResponse<UserInfo>> userInfo(@FieldMap Map<String, String> map);

    /**
     * String userId,
     * String token
     * 收货地址列表
     *
     * @param map
     * @return
     */
    @GET(queryAddress)
    Observable<BaseResponse<List<Address>>> queryAddress(@QueryMap Map<String, String> map);


    /**
     * 查询默认地址
     * String userId,
     * String token
     *
     * @param map
     * @return
     */
    @GET(queryApproveAddress)
    Observable<BaseResponse<Address>> queryApproveAddress(@QueryMap Map<String, String> map);


    /**
     * String addressId,
     * String address,
     * String otpType,
     * String userId,
     * String token
     * 更新收货地址
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(upaAdress)
    Observable<ResponseBody> upaAdress(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST(delAdress)
    Observable<ResponseBody> delAdress(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST(addAdress)
    Observable<ResponseBody> addAdress(@FieldMap Map<String, String> map);


    /**
     * 根据分类查商品
     * String classifyId,
     * String otpType,
     * String userId,
     * String token
     *
     * @return
     */
    @GET(typeGoods)
    Observable<BaseResponse<List<Goods>>> typeGoods(@QueryMap Map<String, String> map);


    /**
     * map
     * 根据上送参数不同，模糊查询商铺商品   全局查询/二级目录查询
     * String classifyId,
     * String goodsName,
     * String shopName,
     * String userId,
     * String token
     *
     * @return
     */
    @FormUrlEncoded
    @POST(secondSearch)
    Observable<BaseResponse<List<Goods>>> secondSearch(@FieldMap Map<String, String> map);


    /**
     * 消息列表
     * String userId,
     * String page,
     * String token
     *
     * @return
     */
    @FormUrlEncoded
    @POST(messageList)
    Observable<BaseResponse<List<Massage>>> messageList(@FieldMap Map<String, String> map);


    /**
     * 查询商铺(商户)
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(store)
    Observable<ResponseBody> store(@FieldMap Map<String, String> map);


    @GET(storeInfo)
    Observable<BaseResponse<StoreInfo>> storeInfo(@Query("shopId") String shopId);


    @FormUrlEncoded
    @POST(comment)
    Observable<ResponseBody> comment(@FieldMap() Map<String, String> map);


    /**
     * String userId,
     * String token
     *
     * @param map
     * @return
     */
    @GET(queryCarList)
    Observable<BaseResponse<List<CarData>>> queryCarList(@QueryMap Map<String, String> map);


    /**
     * 添加购物车
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(addCar)
    Observable<ResponseBody> addCar(@FieldMap Map<String, String> map);

    /**
     * userId
     * token
     * otpType
     * shoppingcarId
     * goodsId
     * shopId
     * shoppingcarNum
     * 修改购物车
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(upCar)
    Observable<ResponseBody> upCar(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST(delCar)
    Observable<ResponseBody> delCar(@FieldMap Map<String, String> map);

    /**
     * String status,
     * String userId,
     * String page,
     * String token
     *
     * @param map
     * @return
     */
    @GET(orderStatus)
    Observable<BaseResponse<List<OrderBetweenDto>>> orderStatus(@QueryMap Map<String, String> map);

    @FormUrlEncoded
    @POST(sureOrder)
    Observable<ResponseBody> sureOrder(@FieldMap Map<String, String> map);

    /**
     * 提交订单
     * token   jsonOrderData  otpType
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(submitOrder)
    Observable<BaseResponse<WeChatPayBean>> submitOrder(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST(submitOrder)
    Observable<ResponseBody> submitListOrder(@FieldMap Map<String, String> map);


    @FormUrlEncoded
    @POST(submitOneOrder)
    Observable<ResponseBody> submitOneOrder(@FieldMap Map<String, String> map);

    @FormUrlEncoded
    @POST(pay)
    Observable<BaseResponse<WeChatPayBean>> pay(@FieldMap Map<String, String> map);

    /**
     * 取消订单
     * String orderId,
     * String userId,
     * String token
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(cancelOrder)
    Observable<ResponseBody> cancelOrder(@FieldMap Map<String, String> map);

    /**
     * 反馈
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(feedBack)
    Observable<ResponseBody> feedBack(@FieldMap Map<String, String> map);

    /**
     * 商品详情
     *
     * @param goodsId
     * @return
     */
    @FormUrlEncoded
    @POST(goodsDetaile)
    Observable<BaseResponse<GoodsDto>> goodsDetaile(@Field("goodsId") String goodsId);

    /**
     * 评论列表
     *
     * @param goodsId
     * @return
     */
    @GET(commentList)
    Observable<BaseResponse<List<Comment>>> commentList(@Query("goodsId") String goodsId, @Query("page") String page);


    @GET(orderdetails)
    Observable<BaseResponse<OrderBetweenDto>> orderdetails(@QueryMap Map<String, String> map);


    @GET(queryordermanage)
    Observable<BaseResponse<LogisticsData>> queryordermanage(@Query("orderBetweenId") String orderId);


    @FormUrlEncoded
    @POST(queryorderbystatus)
    Observable<ResponseBody> queryorderbystatus(@Field("orderid") String orderId);


    @FormUrlEncoded
    @POST(querygoodsdetils)
    Observable<ResponseBody> querygoodsdetils(@Field("goodsId") String goodsId);
}